﻿/*
 * C# enumerators for tif specific types 
 * Copyright (c) Adam Sida, asida@centrum.cz
 * 
 * All rights reserved.
 */

using System;
using System.Collections.Generic;
using System.Text;

namespace Petra.Gis.Geometry.Image.Tiff
{


  public enum TiffDataEndian
  {
    LittleIndian = (Int16)0x4949, //INTEL, AMD, CYRIX
    BigIndian = (Int16)0x4d4d     //MOTOROLA, SPARC, IBM
  }



  //CCIT3,4 dada fill order, default = 1 when not specified in ifd
  public enum FillOrderType { MSB2LSB = 1, LSB2MSB = 2 }

  //CCIT3,4 compression option
  public enum TiffFaxT6Option
  { 
    Compressed = 0x00,
    Uncompressed = 0x02
  }

  public enum TiffFaxT4Option //GROUP3OPT
  {
    Encoding2D = 0x01,	//2-dimensional coding
    Uncompressed = 0x02,	//data not compressed
    FillBits = 0x04	//fill to byte boundary
  }

  public enum T4OptType //GROUP3OPT
  {
    ENCODING2D = 0x1,	/* 2-dimensional coding */
    UNCOMPRESSED = 0x2,	/* data not compressed */
    FILLBITS = 0x4,	/* fill to byte boundary */
  }

  public enum FaxModeType
  {
    CLASSIC = 0x0000,		//default, include RTC
    NORTC = 0x0001,		//no RTC at end of data
    //CLASSF	FAXMODE_NORTC	//TIFF Class F
    NOEOL = 0x0002,		//no EOL code at end of row
    BYTEALIGN = 0x0004,		//byte align row
    WORDALIGN = 0x0008,		//word align row
  }




  public enum CompressionType //COMPRESSION
  {
    UNKNOWN = 0,

    NONE = 1, //dump mode
    CCITTRLE = 2, //CCITT Group 3 1D, modified Huffman RLE
    //CCITTFAX3 = 3, //CCITT Group 3 fax encoding
    CCITT_T4 = 3, //CCITT T.4 (TIFF 6 name)
    //CCITTFAX4 = 4, //CCITT Group 4 fax encoding
    CCITT_T6 = 4, //CCITT T.6 (TIFF 6 name)
    LZW = 5, //Lempel-Ziv  & Welch
    OJPEG = 6, //!6.0 JPEG
    JPEG = 7, //%JPEG DCT compression
    DEFLATE = 8,                //Official Deflate compression by Adobe
    Pegasus_IMJ = 103,                    //Pegasus IMJ
    NEXT = 32766, //NeXT 2-bit RLE
    CCITTRLEW = 32771, //#1 (none) w/ word alignment
    PACKBITS = 32773, //Macintosh RLE
    THUNDERSCAN = 32809, //ThunderScan RLE
    // codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com)
    IT8CTPAD = 32895,   // IT8 CT w/padding
    IT8LW = 32896,   // IT8 Linework RLE
    IT8MP = 32897,   // IT8 Monochrome picture
    IT8BL = 32898,   // IT8 Binary line art
    // compression codes 32908-32911 are reserved for Pixar
    PIXARFILM = 32908, // Pixar companded 10bit LZW
    PIXARLOG = 32909, // Pixar companded 11bit ZIP
    DEFLATE_INOFFICIAL = 32946, //Deflate compression
    // compression code 32947 is reserved for Oceana Matrix <dev@oceana.com>
    DCS = 32947, //Kodak DCS encoding
    JBIG = 34661, //ISO JBIG
    SGILOG = 34676, //SGI Log Luminance RLE
    SGILOG24 = 34677, //SGI Log 24-bit packed
    JP2000 = 34712, //Leadtools JPEG2000
    JBIG2 = 34715,  //JBIG2
  }




  public enum PhotometricType //PHOTOMETRIC
  {
    WhiteIsZero = 0,	//min value is white
    BlackIsZero = 1,	//min value is black
    TruecolorRGB = 2,	//RGB color model
    Paletted = 3,	//color map indexed
    Mask = 4,	//$holdout mask
    TruecolorCMYK = 5,	//!color separations
    YCbCr = 6,	//!CCIR 601
    CIELAB = 8,	//!1976 CIE L*a*b*
    ICCLAB = 9,	//ICC L*a*b* [Adobe TIFF Technote 4]
    ITULAB = 10,	//ITU L*a*b*
    LOGL = 32844,	//PHOTOMETRIC_LOGL, CIE Log2(L)
    TruecolorLOGLUV = 32845,	//PHOTOMETRIC_LOGLUV, CIE Log2(L) (u',v')
  }



  /// <summary>
  /// type of data configuration in tiff file
  /// </summary>
  public enum PlanarConfigurationType //PLANAR
  {
    /// <summary>
    /// single image plane, chunky in Adobe terms
    /// </summary>
    Contignous = 1,

    /// <summary>
    /// separate planes of data, Planar in Adobe terms
    /// </summary>
    Separate = 2,
  }




  public enum TagDataType //TAG_TYPE
  {
    UNKNOWN = 0,     //placeholder

    BYTE = 1,        //8-bit unsigned integer
    ASCII = 2,       //8-bit bytes w/ last byte null
    SHORT = 3,       //16-bit unsigned integer
    LONG = 4,        //32-bit unsigned integer
    RATIONAL = 5,    //64-bit unsigned fraction
    SBYTE = 6,       //!8-bit signed integer
    UNDEFINED = 7,   //!8-bit untyped data
    SSHORT = 8,      //!16-bit signed integer
    SLONG = 9,       //!32-bit signed integer
    SRATIONAL = 10,  //!64-bit signed fraction
    FLOAT = 11,      //!32-bit IEEE floating point
    DOUBLE = 12,     //!64-bit IEEE floating point
    IFD = 13,        //%32-bit unsigned integer (offset)
    LONG8 = 16,      //BigTIFF 64-bit unsigned integer
    SLONG8 = 17,     //BigTIFF 64-bit signed integer
    IFD8 = 18        //BigTIFF 64-bit unsigned integer (offset)
  }




  public enum TiffSampleFormatType //TYPE
  {
    Bilevel1bpp = 0,
    Bilevel8bpp = 8,
    Gray4bpp = 1,
    Gray8bpp = 2,
    Gray16bpp = 3,
    Palette4bpp = 4,
    Palette8bpp = 5,
    Palette16bpp = 30,
    PlanarY8bpp = 20,
    PlanarCb8bpp = 21,
    PlanarCr8bpp = 22,

    InterleavedRgb24bpp = 6,
    InterleavedRgb48bpp = 7,
    InterleavedCMYK32bpp = 9,
    PlanarCMYK32bpp = 10,
    PlanarYCbCr24bpp = 13,
    InterleavedLogLuv32bpp = 11,
    LOGL = 12,
  }






  public enum SubfileType  //tiff page file type
  {
    REDUCEDIMAGE = 0x1,	//reduced resolution version
    PAGE = 0x2,	//one page of many
    MASK = 0x4,	//transparency mask
  }


  public enum OSubfileType  //tiff page file type ??
  {
    IMAGE = 1,/* full resolution image data */
    REDUCEDIMAGE = 2,	/* reduced size image data */
    PAGE = 3,/* one page of many */
  }


  public enum TresholdType
  {
    BILEVEL = 1,/* b&w art scan */
    HALFTONE = 2,	/* or dithered scan */
    ERRORDIFFUSE = 3	/* usually floyd-steinberg */
  }

  public enum OrientationType
  {
    TOPLEFT = 1,	/* row 0 top, col 0 lhs */
    TOPRIGHT = 2,	/* row 0 top, col 0 rhs */
    BOTRIGHT = 3,	/* row 0 bottom, col 0 rhs */
    BOTLEFT = 4,	/* row 0 bottom, col 0 lhs */
    LEFTTOP = 5,	/* row 0 lhs, col 0 top */
    RIGHTTOP = 6,	/* row 0 rhs, col 0 top */
    RIGHTBOT = 7,	/* row 0 rhs, col 0 bottom */
    LEFTBOT = 8	/* row 0 lhs, col 0 bottom */
  }


  public enum SampleFormatType
  {
    UINT = 1,	/* !unsigned integer data */
    INT = 2,	/* !signed integer data */
    IEEEFP = 3,	/* !IEEE floating point data */
    VOID = 4,/* !untyped data */
    COMPLEXINT = 5,/* !complex signed int */
    COMPLEXIEEEFP = 6	/* !complex ieee floating */
  }
}
